//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public abstract class ShadeProperties : IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            ReadXmlCore(context);
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            WriteXmlCore(context);
        }

        #endregion

        internal static ShadeProperties ReadShapeProperties(ReadContext context)
        {
            context.PassAttributes();
            switch (context.ReaderLocalName)
            {
                case "lin":
                    return context.ReadElement<LinearShadeProperties>();
                case "path":
                    return context.ReadElement<PathShadeProperties>();
                default:
                    return null;
            }
        }

        internal abstract void ReadXmlCore(ReadContext context);

        internal abstract void WriteXmlCore(WriteContext context);
    }
}